
/*---------------------------------------------------------
   Init( data table )
---------------------------------------------------------*/
function EFFECT:Init( data )

	self.Pos = data:GetOrigin()
	self.Emitter = ParticleEmitter( self.Pos )
	self.Time = CurTime() + 115
	
end

/*---------------------------------------------------------
   THINK
---------------------------------------------------------*/
function EFFECT:Think( )

	if self.Emitter == nil then return false end
	if self.Time < CurTime() then self:Die() self.Emitter:Finish() return false end
	
	for i=1,math.random(1,3) do
		local particle = self.Emitter:Add( "effects/blueflare1", self.Pos)

		particle:SetVelocity( VectorRand() * math.Rand(50,500) )
		particle:SetDieTime( 2 )
		particle:SetStartAlpha( math.Rand( 120, 140 ) )
		particle:SetEndAlpha( 0 )
		particle:SetStartSize( math.Rand(0.5,1) )
		particle:SetEndSize( 0.01 )
		particle:SetRoll( math.random(1,90) )
		particle:SetRollDelta( math.Rand( 0, 0.1 ) )
		particle:SetColor( 0, math.Rand( 50, 250 ), math.Rand( 50, 250 ) )
		
		particle:SetAirResistance( 100 )
		particle:SetGravity( Vector( 0, 0, -50 ) )
		particle:SetCollide( true )
		particle:SetBounce( .99 )
	end

	return true
end

function EFFECT:Die()
	for i=1,20 do
		local particle = self.Emitter:Add( "effects/blueflare1", self.Pos)

		particle:SetVelocity( VectorRand() * math.Rand(50,500) )
		particle:SetDieTime( 2 )
		particle:SetStartAlpha( math.Rand( 120, 140 ) )
		particle:SetEndAlpha( 0 )
		particle:SetStartSize( math.Rand(1,2) )
		particle:SetEndSize( 0.01 )
		particle:SetRoll( math.random(1,90) )
		particle:SetRollDelta( math.Rand( 0, 0.1 ) )
		particle:SetColor( 0, math.Rand( 50, 250 ), math.Rand( 50, 250 ) )
		
		particle:SetAirResistance( 100 )
		particle:SetGravity( Vector( 0, 0, -50 ) )
		particle:SetCollide( true )
		particle:SetBounce( .99 )
	end
end

/*---------------------------------------------------------
   Draw the effect
---------------------------------------------------------*/
function EFFECT:Render( )

end
